package study.day5.t7;

public class Master {
    //多态的实现
    public void feed(Pet pet, int num){
        pet.eat(num);
    }

    //Master让宠物工作
    public void work(Pet pet){
        //判断是什么宠物，用对象 instanceof 类型
        if(pet instanceof Dog dog){
            dog.seeDoor();
        } else if (pet instanceof Cat cat){
            cat.catchMouse();
        }
    }
}
